package com.hbsi.iodemo3;

import org.junit.jupiter.api.Test;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * @author 程奕红
 * @version 1.0
 */
public class TestOutPutStreamWriter {
    public static void main(String[] args) {

    }
    @Test
    public void write01(){
        String filepath="e:\\cc.txt";
        FileOutputStream fileOutputStream=null;
        String str="hello world";
        try {
            fileOutputStream=new FileOutputStream(filepath);
            fileOutputStream.write(str.getBytes());
        }
        catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                fileOutputStream.close();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        System.out.println("内容写入成功");
    }

}
